//公共最长子序列问题
use std::cmp;

pub fn lcs(s1:&[char],s2:&[char])->i32{
    let mut c = vec![];
    for _ in (0..(s1.len()+1)){
        c.push(vec![0;s2.len()+1]);
    }

    for ii32 in 0..s1.len() {
        for ji32 in 0..s2.len() {
            let i = ii32 as usize;
            let j = ji32 as usize;
            if s1[i]==s2[j] {
                c[i+1][j+1] = c[i][j]+1;
            }else{
                c[i+1][j+1] = cmp::max(c[i+1][j],c[i][j+1]);
            }
        }
    }
    c[s1.len() as usize][s2.len() as usize]
}
